package pojo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hamcrest.Factory;

@Entity()
@Table(name = "merchant")
@SequenceGenerator(name="bryceq",sequenceName="seq01",initialValue=1,allocationSize=1)
public class Merchant {
	@Id
	@GeneratedValue(generator="bryceq",strategy=GenerationType.SEQUENCE)
//	@GeneratedValue(strategy=GenerationType.AUTO)//oracle不建议用
	private Integer id;
	@Column(name = "name", nullable = false, length = 40, insertable = true, updatable = true, unique = false)
	private String name;
	// @Transient

	@Column(columnDefinition = "char(1)")
	private boolean sex;
	private int age;
	@OneToOne(mappedBy="merchant")
	private Address addr;

	public Merchant(Integer id, String name, boolean sex, int age) {
		super();
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.age = age;
	}

	public boolean isSex() {
		return sex;
	}

	public void setSex(boolean sex) {
		this.sex = sex;
	}

	public Merchant() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	public String toString() {
		return "Merchant [id=" + id + ", name=" + name + ", sex=" + sex + ", age=" + age + "]";
	}
}
